﻿#include "OperGraphPreprocess.h"

// APP
#include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h"
#include "FITK_Kernel/FITKAppFramework/FITKGlobalData.h"
#include "FITK_Kernel/FITKAppFramework/FITKAppSettings.h"
#include "FITK_Kernel/FITKAppFramework/FITKRunTimeSetting.h"

// Global data
#include "FITK_Kernel/FITKCore/FITKDataRepo.h"

// Graph widget and object
#include "FITK_Component/FITKRenderWindowVTK/FITKGraph3DWindowVTK.h"
#include "FITK_Component/FITKAcousticsVTKGraphAdaptor/FITKAcousticsVTKGraphObject3D.h"

// Data
#include "FITK_Component/FITKAcousticsModel/FITKAbstractSEASubSys.h"
#include "FITK_Component/FITKAcousticsModel/FITKSEAAbstractJunction.h"
#include "FITK_Interface/FITKInterfaceGeometry/FITKAbsGeoCommand.h"

// Graph data manager
#include "GraphDataProvider/GraphProviderManager.h"
#include "GraphDataProvider/GraphModelProvider.h"
#include "GraphDataProvider/GraphMarkProvider.h"

// Pick
#include "PickDataProvider/GUIPickInfo.h"

// Operators
#include "OperatorsInterface/GraphInteractionOperator.h"

namespace GUIOper
{
    void OperGraphPreprocess::updateAll(bool forceUpdate)
    {
        // 更新模型。
        updateGeoAndMesh(true, forceUpdate);

        // 更新SEA节点。
        updateDiscNodes(forceUpdate);

        // 更新SEA子系统。
        updateSEASubSystems(forceUpdate);

        // 更新连接关系。
        updateJunctions(forceUpdate);

        // 更新SEA模型自由边。
        updateSEAFreeEdges();

        // 更新载荷。
        updateLoads(forceUpdate);

        // 更新FE面
        updateFEFaces(forceUpdate);

        // 更新FE子系统
        updateFESubSystems(forceUpdate);

        //更新传感器
        updateSensors(forceUpdate);

        // 重新渲染。
        reRender();
        fitView();

        // 刷新相机敏感对象尺寸与方向。（需要先渲染对象后才可执行）
        updateWithCameraChanged();
    }

    void OperGraphPreprocess::updateAllVisibility()
    {
        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                continue;
            }

            // 获取模型可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            if (!modelProvider) {
                return;
            }
            // 获取符号可视化对象管理器。
            GraphData::GraphMarkProvider* markProvider = GraphData::GraphProviderManager::getInstance()->getMarkProvider(graphWidget);
            if (!markProvider) {
                return;
            }

            //获取所有可视化对象
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = {};
            objs << modelProvider->getAllModelGraphObjects(false);
            objs << modelProvider->getAllMeshGraphObjects(false);
            objs << modelProvider->getAllSEASubSysGraphObjects(false);
            objs << modelProvider->getAllFESubSysGraphObjects(false);
            objs << modelProvider->getAllFEFaceGraphObjects(false);
            objs << modelProvider->getAllSensorGraphObjects(false);
            objs << markProvider->getAllJunctionGraphObjects(false);
            objs << markProvider->getAllLoadGraphObjects(false);

            // 添加至三维窗口。
            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs) {
                if (!obj) {
                    continue;
                }
                obj->updateVisibility();
            }
        }

        // 重新渲染。
        reRender();

        // 刷新相机敏感对象尺寸与方向。（需要先渲染对象后才可执行）
        updateWithCameraChanged();
    }

    void OperGraphPreprocess::updateGraph(int dataObjId, bool forceUpdate)
    {
        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                continue;
            }

            // 获取或创建可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = getGraphObjectsByDataId(dataObjId, forceUpdate);

            // 添加至三维窗口。
            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                addGraphObjectToWidget(obj, graphWidget, false);

                obj->update(forceUpdate);

                // 添加到窗口后根据相机参数更新对象。
                // obj->updateByCamera();
            }
        }

        // 刷新渲染。
        reRender();
    }

    void OperGraphPreprocess::updateGeoAndMesh(bool autoCreate, bool forceUpdate)
    {
        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                continue;
            }

            // 获取模型可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            if (!modelProvider)
            {
                return;
            }

            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs;

            // 获取全部几何可视化对象。
            objs << modelProvider->getAllModelGraphObjects(autoCreate);

            // 获取全部网格可视化对象。
            objs << modelProvider->getAllMeshGraphObjects(autoCreate);

            // 添加至三维窗口。
            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                // 刷新对象。
                obj->update(forceUpdate);

                fastAddGraphObjectToWidget(obj, graphWidget);
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        // 刷新渲染。
        reRender();
    }

    void OperGraphPreprocess::updateGeometrys(bool autoCreate, bool forceUpdate)
    {
        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                continue;
            }

            // 获取模型可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            if (!modelProvider)
            {
                return;
            }

            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs;

            // 获取全部几何可视化对象。
            objs << modelProvider->getAllModelGraphObjects(autoCreate);

            // 添加至三维窗口。
            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                // 刷新对象。
                obj->update(forceUpdate);

                fastAddGraphObjectToWidget(obj, graphWidget);
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        // 刷新渲染。
        reRender();
    }

    void OperGraphPreprocess::updateMeshes(bool autoCreate, bool forceUpdate)
    {
        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                continue;
            }

            // 获取模型可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            if (!modelProvider)
            {
                return;
            }

            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs;

            // 获取全部网格可视化对象。
            objs << modelProvider->getAllMeshGraphObjects(autoCreate);

            // 添加至三维窗口。
            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                fastAddGraphObjectToWidget(obj, graphWidget);

                // 刷新对象。
                obj->update(forceUpdate);
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        // 刷新渲染。
        reRender();
    }

    void OperGraphPreprocess::updateDiscNodes(bool forceUpdate)
    {
        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                continue;
            }

            // 获取模型可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            if (!modelProvider)
            {
                return;
            }

            Exchange::FITKAcousticsVTKGraphObject3D* obj = modelProvider->getDiscNodesGraphObject();
            if (!obj)
            {
                return;
            }

            // 添加至三维窗口。
            fastAddGraphObjectToWidget(obj, graphWidget);

            // 刷新节点数据。
            obj->update(forceUpdate);

            // 更新视口裁切距离。
            graphWidget->updateBoundray();
        }

        // 刷新渲染。
        reRender();
    }

    void OperGraphPreprocess::updateSEAFreeEdges()
    {
        // 获取自由边
        bool showFreeEdges = false;
        AppFrame::FITKRunTimeSetting* rtSettings = FITKAPP->getGlobalData()->getRunTimeSetting();
        if (rtSettings)
        {
            showFreeEdges = rtSettings->getValueT<bool>(RTS_KEY_VISIBLE_SEA_FREE_EDGES);
        }

        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                continue;
            }

            // 获取符号可视化对象管理器。
            GraphData::GraphMarkProvider* markProvider = GraphData::GraphProviderManager::getInstance()->getMarkProvider(graphWidget);
            if (!markProvider)
            {
                return;
            }

            // 获取SEA模型自由边可视化对象。
            Exchange::FITKAcousticsVTKGraphObject3D* obj = markProvider->getSEAFreeEdgesGraphObject(showFreeEdges);
            if (!obj)
            {
                return;
            }

            if (showFreeEdges)
            {
                // 刷新对象。
                obj->update(true);

                addGraphObjectToWidget(obj, graphWidget, false);
            }
            else
            {
                // 未显示自由边则不进行计算，节约资源。
                obj->updateVisibility();
            }
        }

        // 刷新渲染。
        reRender();
    }

    void OperGraphPreprocess::updateSEASubSystems(bool forceUpdate)
    {
        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                continue;
            }

            // 获取模型可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            if (!modelProvider)
            {
                return;
            }

            Exchange::FITKAcousticsVTKCommons::ShapePickMode pickMode =
                GUI::GUIPickInfo::PickObjType::POBJNone == GUI::GUIPickInfo::GetPickInfo()._pickObjType ?
                Exchange::FITKAcousticsVTKCommons::ShapePickMode::PickAll :
                Exchange::FITKAcousticsVTKCommons::ShapePickMode::PickNone;

            // 获取SEA子系统可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = modelProvider->getAllSEASubSysGraphObjects(true);

            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                // 刷新对象。
                obj->update(forceUpdate);
                obj->setPickMode(pickMode);

                fastAddGraphObjectToWidget(obj, graphWidget);
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        // 刷新渲染。
        reRender();
    }

    void OperGraphPreprocess::updateFEFaces(bool forceUpdate)
    {
        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                continue;
            }

            // 获取模型可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            if (!modelProvider)
            {
                return;
            }

            Exchange::FITKAcousticsVTKCommons::ShapePickMode pickMode =
                GUI::GUIPickInfo::PickObjType::POBJNone == GUI::GUIPickInfo::GetPickInfo()._pickObjType ?
                Exchange::FITKAcousticsVTKCommons::ShapePickMode::PickAll :
                Exchange::FITKAcousticsVTKCommons::ShapePickMode::PickNone;

            // 获取FE面可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = modelProvider->getAllFEFaceGraphObjects(true);

            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                // 刷新对象。
                obj->update(forceUpdate);
                obj->setPickMode(pickMode);

                fastAddGraphObjectToWidget(obj, graphWidget);
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        // 刷新渲染。
        reRender();
    }

    void OperGraphPreprocess::updateSEASubSystem(int subSysTypeEnum, bool forceUpdate)
    {
        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                continue;
            }

            // 获取模型可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            if (!modelProvider)
            {
                return;
            }

            Exchange::FITKAcousticsVTKCommons::ShapePickMode pickMode =
                GUI::GUIPickInfo::PickObjType::POBJNone == GUI::GUIPickInfo::GetPickInfo()._pickObjType ?
                Exchange::FITKAcousticsVTKCommons::ShapePickMode::PickAll :
                Exchange::FITKAcousticsVTKCommons::ShapePickMode::PickNone;

            // 获取SEA子系统可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = modelProvider->getSEASubSysGraphObjectsByType(subSysTypeEnum, false);

            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                // 刷新对象。
                obj->update(forceUpdate);
                obj->setPickMode(pickMode);

                fastAddGraphObjectToWidget(obj, graphWidget);
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        // 刷新渲染。
        reRender();
    }

    void OperGraphPreprocess::updateJunctions(bool forceUpdate)
    {
        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                continue;
            }

            // 获取符号可视化对象管理器。
            GraphData::GraphMarkProvider* markProvider = GraphData::GraphProviderManager::getInstance()->getMarkProvider(graphWidget);
            if (!markProvider)
            {
                return;
            }

            Exchange::FITKAcousticsVTKCommons::ShapePickMode pickMode =
                GUI::GUIPickInfo::PickObjType::POBJNone == GUI::GUIPickInfo::GetPickInfo()._pickObjType ?
                Exchange::FITKAcousticsVTKCommons::ShapePickMode::PickAll :
                Exchange::FITKAcousticsVTKCommons::ShapePickMode::PickNone;

            // 获取SEA连接关系可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = markProvider->getAllJunctionGraphObjects(true);
            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                // 刷新对象。
                obj->update(forceUpdate);
                obj->setPickMode(pickMode);

                fastAddGraphObjectToWidget(obj, graphWidget);
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        // 刷新渲染。
        reRender();
    }

    void OperGraphPreprocess::updateFESubSystems(bool forceUpdate)
    {
        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                continue;
            }

            // 获取模型可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            if (!modelProvider) {
                return;
            }

            Exchange::FITKAcousticsVTKCommons::ShapePickMode pickMode =
                GUI::GUIPickInfo::PickObjType::POBJNone == GUI::GUIPickInfo::GetPickInfo()._pickObjType ?
                Exchange::FITKAcousticsVTKCommons::ShapePickMode::PickAll :
                Exchange::FITKAcousticsVTKCommons::ShapePickMode::PickNone;

            // 获取FE子系统可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = modelProvider->getAllFESubSysGraphObjects(true);
            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs) {
                if (!obj) {
                    continue;
                }

                // 刷新对象。
                obj->update(forceUpdate);
                obj->setPickMode(pickMode);

                fastAddGraphObjectToWidget(obj, graphWidget);
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        // 刷新渲染。
        reRender();
    }

    void OperGraphPreprocess::updateLoads(bool forceUpdate)
    {
        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                continue;
            }

            // 获取符号可视化对象管理器。
            GraphData::GraphMarkProvider* markProvider = GraphData::GraphProviderManager::getInstance()->getMarkProvider(graphWidget);
            if (!markProvider)
            {
                return;
            }

            Exchange::FITKAcousticsVTKCommons::ShapePickMode pickMode =
                GUI::GUIPickInfo::PickObjType::POBJNone == GUI::GUIPickInfo::GetPickInfo()._pickObjType ?
                Exchange::FITKAcousticsVTKCommons::ShapePickMode::PickAll :
                Exchange::FITKAcousticsVTKCommons::ShapePickMode::PickNone;

            // 获取载荷可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = markProvider->getAllLoadGraphObjects(true);
            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                // 刷新对象。
                obj->update(forceUpdate);
                obj->setPickMode(pickMode);

                fastAddGraphObjectToWidget(obj, graphWidget);
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        // 刷新渲染。
        reRender();
    }

    void OperGraphPreprocess::updateSensors(bool forceUpdate)
    {
        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                continue;
            }

            // 获取模型可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            if (!modelProvider) {
                return;
            }

            Exchange::FITKAcousticsVTKCommons::ShapePickMode pickMode =
                GUI::GUIPickInfo::PickObjType::POBJNone == GUI::GUIPickInfo::GetPickInfo()._pickObjType ?
                Exchange::FITKAcousticsVTKCommons::ShapePickMode::PickAll :
                Exchange::FITKAcousticsVTKCommons::ShapePickMode::PickNone;

            // 获取FE传感器可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = modelProvider->getAllSensorGraphObjects(true);
            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs) {
                if (!obj) {
                    continue;
                }

                // 刷新对象。
                obj->update(forceUpdate);
                obj->setPickMode(pickMode);

                fastAddGraphObjectToWidget(obj, graphWidget);
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        // 刷新渲染。
        reRender();
    }

    void OperGraphPreprocess::setCADVisiblity(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_CAD, visibility);

        updateGeoAndMesh(false, false);
    }

    void OperGraphPreprocess::setGeometrysVisiblity(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_GEOMETRY, visibility);

        updateGeometrys(false, false);
    }

    void OperGraphPreprocess::setGeoPointsVisiblity(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_GEOM_VERTS, visibility);

        updateGeometrys(false, false);
    }

    void OperGraphPreprocess::setGeoEdgesVisiblity(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_GEOM_EDGES, visibility);

        updateGeometrys(false, false);
    }

    void OperGraphPreprocess::setGeoFacesVisiblity(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_GEOM_FACES, visibility);

        updateGeometrys(false, false);
    }

    void OperGraphPreprocess::setGeoSolidsVisiblity(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_GEOM_SOLIDS, visibility);

        updateGeometrys(false, false);
    }

    void OperGraphPreprocess::setMeshesVisiblity(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_MESH, visibility);

        updateMeshes(false, false);
    }

    void OperGraphPreprocess::setUsedDiscNodesVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_GRAPH_NODES, visibility);

        updateDiscNodes(false);
    }

    void OperGraphPreprocess::setUnusedDiscNodesVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_UNUSED_NODES, visibility);

        updateDiscNodes(false);
    }

    void OperGraphPreprocess::setNodeLabelsVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_NODE_LABELS, visibility);

        updateDiscNodes(false);
    }

    void OperGraphPreprocess::setDiscNodesVisibility(bool visibleObjects, bool unused)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_GRAPH_NODES, visibleObjects);
        saveRuntimeSettings(RTS_KEY_VISIBLE_UNUSED_NODES, unused);

        updateDiscNodes(false);
    }

    void OperGraphPreprocess::setSEAFreeEdgesVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_SEA_FREE_EDGES, visibility);

        updateSEAFreeEdges();
    }

    void OperGraphPreprocess::setSubSystemsVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_SUB_SYSTEMS, visibility);

        updateSEASubSystemsVisibility();
        updateFESubSystemsVisibility();
        updateFEFacesVisibility();
        updateSensorsVisibility();
    }

    void OperGraphPreprocess::setSEASubSystemsVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_SEA_SUBSYS, visibility);

        updateSEASubSystemsVisibility();
    }

    void OperGraphPreprocess::setSEASubSystemShellsVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_SEA_SUBSYS_SHELLS, visibility);
        updateSEASubSystemShellsVisibility();
    }

    void OperGraphPreprocess::setSEASubSystemsVisibility(int subSysTypeEnum, bool visibility)
    {
        // 保存配置。
        switch (subSysTypeEnum)
        {
        case Acoustics::FITKAbstractSEASubSys::SEABeam:
            saveRuntimeSettings(RTS_KEY_VISIBLE_SEA_SUBSYS_BEAM, visibility);
            break;
        case Acoustics::FITKAbstractSEASubSys::SEAFlatPlate:
            saveRuntimeSettings(RTS_KEY_VISIBLE_SEA_SUBSYS_FLAT_PLATE, visibility);
            break;
        case Acoustics::FITKAbstractSEASubSys::SEASinglyCurvedShell:
            saveRuntimeSettings(RTS_KEY_VISIBLE_SEA_SUBSYS_S_CUR_PLATE, visibility);
            break;
        case Acoustics::FITKAbstractSEASubSys::SEADoublyCurvedShell:
            saveRuntimeSettings(RTS_KEY_VISIBLE_SEA_SUBSYS_D_CUR_PLATE, visibility);
            break;
        case Acoustics::FITKAbstractSEASubSys::SEACylinderShell:
            saveRuntimeSettings(RTS_KEY_VISIBLE_SEA_SUBSYS_CYLINDER_PLATE, visibility);
            break;
        case Acoustics::FITKAbstractSEASubSys::SEACavity:
            saveRuntimeSettings(RTS_KEY_VISIBLE_SEA_SUBSYS_CAVITY, visibility);
            break;
        case Acoustics::FITKAbstractSEASubSys::SEASemiIInfiniteFluid:
            saveRuntimeSettings(RTS_KEY_VISIBLE_SEA_SUBSYS_SEMI_INF_FLUID, visibility);
            break;
        default:
            break;
        }

        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                return;
            }

            // 获取模型可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            if (!modelProvider)
            {
                return;
            }

            // 获取指定类型SEA子系统可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = modelProvider->getSEASubSysGraphObjectsByType(subSysTypeEnum, false);
            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                fastAddGraphObjectToWidget(obj, graphWidget);

                // 刷新对象。
                obj->updateVisibility();
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        reRender();
    }

    void OperGraphPreprocess::setFESubSystemsVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_FE, visibility);
        updateFEFacesVisibility();
        updateFESubSystemsVisibility();
    }

    void OperGraphPreprocess::setFEFaceVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_FE_SURFACE, visibility);

        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                return;
            }

            // 获取模型可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            if (!modelProvider) {
                return;
            }

            // 获取FE面可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = modelProvider->getFEFaceGraphObjects(true);
            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                fastAddGraphObjectToWidget(obj, graphWidget);

                // 刷新对象。
                obj->updateVisibility();
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        reRender();
    }

    void OperGraphPreprocess::setFEStructVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_FE_STRUCT, visibility);

        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                return;
            }

            // 获取模型可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            if (!modelProvider) {
                return;
            }

            // 获取FE面可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = modelProvider->getFEStructGraphObjects(true);
            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                fastAddGraphObjectToWidget(obj, graphWidget);

                // 刷新对象。
                obj->updateVisibility();
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        reRender();
    }

    void OperGraphPreprocess::setFEAcousticsVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_FE_ACOUSTICS, visibility);

        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                return;
            }

            // 获取模型可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            if (!modelProvider) {
                return;
            }

            // 获取FE面可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = modelProvider->getFEAcousticsGraphObjects(true);
            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                fastAddGraphObjectToWidget(obj, graphWidget);

                // 刷新对象。
                obj->updateVisibility();
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        reRender();
    }

    void OperGraphPreprocess::setJunctionsVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_JUNCTIONS, visibility);

        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                return;
            }

            // 获取符号可视化对象管理器。
            GraphData::GraphMarkProvider* markProvider = GraphData::GraphProviderManager::getInstance()->getMarkProvider(graphWidget);
            if (!markProvider)
            {
                return;
            }

            // 获取全部连接区域可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = markProvider->getAllJunctionGraphObjects();
            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                fastAddGraphObjectToWidget(obj, graphWidget);

                // 刷新对象。
                obj->update();
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        reRender();
    }

    void OperGraphPreprocess::setJunctionPointsVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_JUNCTION_POINTS, visibility);

        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                return;
            }

            // 获取符号可视化对象管理器。
            GraphData::GraphMarkProvider* markProvider = GraphData::GraphProviderManager::getInstance()->getMarkProvider(graphWidget);
            if (!markProvider)
            {
                return;
            }

            // 获取指定类型SEA & FE & Mix连接点可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = markProvider->
                getJunctionGraphObjectsByType(Acoustics::FITKAbstractJunction::JunctionType::SEAPointJunction);

            // TODO
            // 获取FE与Mix连接点可视化对象

            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                fastAddGraphObjectToWidget(obj, graphWidget);

                // 刷新对象。
                obj->updateVisibility();
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        reRender();
    }

    void OperGraphPreprocess::setJunctionLinesVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_JUNCTION_LINES, visibility);

        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                return;
            }

            // 获取符号可视化对象管理器。
            GraphData::GraphMarkProvider* markProvider = GraphData::GraphProviderManager::getInstance()->getMarkProvider(graphWidget);
            if (!markProvider)
            {
                return;
            }

            // 获取指定类型SEA & FE & Mix连接线可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = markProvider->
                getJunctionGraphObjectsByType(Acoustics::FITKAbstractJunction::JunctionType::SEALineJunction);

            // TODO
            // 获取FE与Mix连接线可视化对象

            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                fastAddGraphObjectToWidget(obj, graphWidget);

                // 刷新对象。
                obj->updateVisibility();
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        reRender();
    }

    void OperGraphPreprocess::setJunctionAreasVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_JUNCTION_AREAS, visibility);

        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                return;
            }

            // 获取符号可视化对象管理器。
            GraphData::GraphMarkProvider* markProvider = GraphData::GraphProviderManager::getInstance()->getMarkProvider(graphWidget);
            if (!markProvider)
            {
                return;
            }

            // 获取指定类型SEA & FE & Mix连接区域可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = markProvider->
                getJunctionGraphObjectsByType(Acoustics::FITKAbstractJunction::JunctionType::SEAAreaJunction);

            // TODO
            // 获取FE与Mix连接区域可视化对象

            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                fastAddGraphObjectToWidget(obj, graphWidget);

                // 刷新对象。
                obj->updateVisibility();
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        reRender();
    }

    void OperGraphPreprocess::setSEAJunctionPointsVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_SEA_JUNC_POINTS, visibility);

        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                return;
            }

            // 获取符号可视化对象管理器。
            GraphData::GraphMarkProvider* markProvider = GraphData::GraphProviderManager::getInstance()->getMarkProvider(graphWidget);
            if (!markProvider)
            {
                return;
            }

            // 获取指定类型SEA连接关系可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = markProvider->
                getJunctionGraphObjectsByType(Acoustics::FITKAbstractJunction::JunctionType::SEAPointJunction);
            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                fastAddGraphObjectToWidget(obj, graphWidget);

                // 刷新对象。
                obj->updateVisibility();
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        reRender();
    }

    void OperGraphPreprocess::setSEAJunctionLinesVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_SEA_JUNC_LINES, visibility);

        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                return;
            }

            // 获取符号可视化对象管理器。
            GraphData::GraphMarkProvider* markProvider = GraphData::GraphProviderManager::getInstance()->getMarkProvider(graphWidget);
            if (!markProvider)
            {
                return;
            }

            // 获取指定类型SEA连接关系可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = markProvider->
                getJunctionGraphObjectsByType(Acoustics::FITKAbstractJunction::JunctionType::SEALineJunction);
            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                fastAddGraphObjectToWidget(obj, graphWidget);

                // 刷新对象。
                obj->updateVisibility();
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        reRender();
    }

    void OperGraphPreprocess::setSEAJunctionAreasVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_SEA_JUNC_AREAS, visibility);

        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                return;
            }

            // 获取符号可视化对象管理器。
            GraphData::GraphMarkProvider* markProvider = GraphData::GraphProviderManager::getInstance()->getMarkProvider(graphWidget);
            if (!markProvider)
            {
                return;
            }

            // 获取指定类型SEA连接关系可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = markProvider->
                getJunctionGraphObjectsByType(Acoustics::FITKAbstractJunction::JunctionType::SEAAreaJunction);
            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                fastAddGraphObjectToWidget(obj, graphWidget);

                // 刷新对象。
                obj->updateVisibility();
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        reRender();
    }

    void OperGraphPreprocess::setLoadsVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_LOADS, visibility);

        updateLoadsVisibility();
    }

    void OperGraphPreprocess::setLoadsPointForceVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_LOAD_POINTFORCE, visibility);

        updateLoadsVisibility();
    }

    void OperGraphPreprocess::setLoadsPowerVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_LOAD_POWER, visibility);

        updateLoadsVisibility();
    }

    void OperGraphPreprocess::setLoadsConstraintVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_LOAD_CONSTRAINT, visibility);

        updateLoadsVisibility();
    }

    void OperGraphPreprocess::setLoadsHVACNoiseVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_LOAD_HVACNoise, visibility);

        updateLoadsVisibility();
    }

    void OperGraphPreprocess::setLoadsMonopoleVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_LOAD_MONOPOLE, visibility);

        updateLoadsVisibility();
    }

    void OperGraphPreprocess::setSensorVisibility(bool visibility)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_VISIBLE_SENSOR, visibility);

        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                return;
            }

            // 获取符号可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            if (!modelProvider)
            {
                return;
            }

            // 获取指定类型SEA连接关系可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = modelProvider->getAllSensorGraphObjects(true);
            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs) {
                if (!obj) {
                    continue;
                }

                fastAddGraphObjectToWidget(obj, graphWidget);

                // 刷新对象。
                obj->updateVisibility();
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        reRender();
    }

    void OperGraphPreprocess::setEnableSubSystemScale(bool isOn)
    {
        // 保存配置。
        saveRuntimeSettings(RTS_KEY_SCALE_MODE, isOn);

        // 获取前处理可视化窗口。
        Comp::FITKGraph3DWindowVTK* graphWidget = getPreGraphWidget();
        if (!graphWidget)
        {
            return;
        }

        // 获取模型可视化对象管理器。
        GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
        if (!modelProvider)
        {
            return;
        }

        // 获取SEA子系统可视化对象。
        QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = modelProvider->getAllSEASubSysGraphObjects();
        for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
        {
            if (!obj)
            {
                continue;
            }

            fastAddGraphObjectToWidget(obj, graphWidget);

            // 更新缩放。
            obj->update();
        }

        // 重新计算包围盒。
        graphWidget->updateBoundray();

        // 刷新渲染。
        reRender();
    }

    void OperGraphPreprocess::hightGraphObj(int objID, bool forceUpdate)
    {
        // 获取前处理可视化窗口。
        Comp::FITKGraph3DWindowVTK* graphWidget = getPreGraphWidget();
        if (graphWidget == nullptr) {
            return;
        }

        // 获取或创建可视化对象。
        QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = getGraphObjectsByDataId(objID);

        for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs){
            if (!obj){
                continue;
            }
            obj->highlight(objID);
            obj->update(forceUpdate);
        }

        // 刷新渲染。
        reRender();
    }

    void OperGraphPreprocess::disHightGraphObj(int objID, bool forceUpdate)
    {
        // 获取前处理可视化窗口。
        Comp::FITKGraph3DWindowVTK* graphWidget = getPreGraphWidget();
        if (graphWidget == nullptr) {
            return;
        }

        // 获取可视化对象。
        QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = getGraphObjectsByDataId(objID);
        for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs) {
            if (!obj) {
                continue;
            }
            obj->disHighlight(objID);
            obj->update(forceUpdate);
        }

        // 刷新渲染。
        reRender();
    }

    void OperGraphPreprocess::clearAllHightGraph()
    {

    }

    void OperGraphPreprocess::updateWithCameraChanged()
    {
        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                continue;
            }

            // 获取模型与符号可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            GraphData::GraphMarkProvider* markProvider = GraphData::GraphProviderManager::getInstance()->getMarkProvider(graphWidget);
            if (!modelProvider || !markProvider)
            {
                return;
            }

            // 尝试刷新全部相机敏感可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs;
            objs << modelProvider->getCurrentCameraSenGraphObjs();
            objs << markProvider->getCurrentCameraSenGraphObjs();

            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (obj)
                {
                    obj->updateByCamera();
                }
            }
        }

        // 刷新渲染。
        reRender();
    }

    void OperGraphPreprocess::updateGraphRecursively(int dataObjId, int refLayer, bool recDown)
    {
        // 检查数据ID。
        Interface::FITKAbsGeoCommand* cmd = FITKDATAREPO->getTDataByID<Interface::FITKAbsGeoCommand>(dataObjId);
        if (!cmd){
            return;
        }

        // 更新可视化对象。
        updateGraph(dataObjId);

        // 更新引用数据对象。
        if (refLayer != 0)
        {
            int subLayer = refLayer == -1 ? -1 : refLayer - 1;

            if (recDown)
            {
                int nRefedCmd = cmd->getReferencedCmdCount();
                for (int i = 0; i < nRefedCmd; i++)
                {
                    Interface::FITKAbsGeoCommand* cmdRef = cmd->getReferencedCmdByIndex(i);
                    if (!cmdRef)
                    {
                        continue;
                    }

                    // 递归更新。
                    updateGraphRecursively(cmdRef->getDataObjectID(), subLayer, recDown);
                }
            }
            else
            {
                int nRefCmd = cmd->getReferenceCmdCount();
                for (int i = 0; i < nRefCmd; i++)
                {
                    Interface::FITKAbsGeoCommand* cmdRef = cmd->getReferenceCmdByIndex(i);
                    if (!cmdRef)
                    {
                        continue;
                    }

                    // 递归更新。
                    updateGraphRecursively(cmdRef->getDataObjectID(), subLayer, recDown);
                }
            }
        }
    }

    void OperGraphPreprocess::updateSEASubSystemsVisibility()
    {
        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (!graphWidget)
            {
                return;
            }

            // 获取模型可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            if (!modelProvider)
            {
                return;
            }

            // 获取SEA子系统可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = modelProvider->getAllSEASubSysGraphObjects(false);

            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                // 刷新对象。
                obj->updateVisibility();

                fastAddGraphObjectToWidget(obj, graphWidget);
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        reRender();
    }

    void OperGraphPreprocess::updateSEASubSystemShellsVisibility()
    {
        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr){
                return;
            }

            // 获取模型可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            if (modelProvider == nullptr){
                return;
            }

            // 获取SEA子系统可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs;
            objs << modelProvider->getAllSEAShellGraphObjects(false);

            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs){
                if (obj == nullptr){
                    continue;
                }

                // 刷新对象。
                obj->updateVisibility();

                fastAddGraphObjectToWidget(obj, graphWidget);
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        reRender();
    }

    void OperGraphPreprocess::updateFESubSystemsVisibility()
    {
        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                return;
            }

            // 获取模型可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            if (!modelProvider)
            {
                return;
            }

            // 获取FE子系统可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = modelProvider->getAllFESubSysGraphObjects(true);

            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                // 刷新对象。
                obj->updateVisibility();

                fastAddGraphObjectToWidget(obj, graphWidget);
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        reRender();
    }

    void OperGraphPreprocess::updateFEFacesVisibility()
    {
        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                return;
            }

            // 获取模型可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            if (!modelProvider)
            {
                return;
            }

            // 获取FE子系统可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = modelProvider->getAllFEFaceGraphObjects(true);

            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                // 刷新对象。
                obj->updateVisibility();

                fastAddGraphObjectToWidget(obj, graphWidget);
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        reRender();
    }

    void OperGraphPreprocess::updateSensorsVisibility()
    {     
        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                return;
            }

            // 获取模型可视化对象管理器。
            GraphData::GraphModelProvider* modelProvider = GraphData::GraphProviderManager::getInstance()->getModelProvider(graphWidget);
            if (!modelProvider)
            {
                return;
            }

            // 获取FE子系统可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = modelProvider->getAllSensorGraphObjects(true);

            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                // 刷新对象。
                obj->updateVisibility();

                fastAddGraphObjectToWidget(obj, graphWidget);
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        reRender();
    }

    void OperGraphPreprocess::updateLoadsVisibility()
    {
        for (Comp::FITKGraph3DWindowVTK* graphWidget : getAllGraphWidget()) {
            if (graphWidget == nullptr) {
                return;
            }

            // 获取符号可视化对象管理器。
            GraphData::GraphMarkProvider* markProvider = GraphData::GraphProviderManager::getInstance()->getMarkProvider(graphWidget);
            if (!markProvider)
            {
                return;
            }

            // 获取全部载荷可视化对象。
            QList<Exchange::FITKAcousticsVTKGraphObject3D*> objs = markProvider->getAllLoadGraphObjects();
            for (Exchange::FITKAcousticsVTKGraphObject3D* obj : objs)
            {
                if (!obj)
                {
                    continue;
                }

                fastAddGraphObjectToWidget(obj, graphWidget);

                // 刷新对象。
                obj->updateVisibility();
            }

            // 重新计算包围盒。
            graphWidget->updateBoundray();
        }

        reRender();
    }
}  // namespace GUIOper
